package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.domain.bo.VProjectDocumentBo;
import com.project.domain.entity.xjProject.BizXjProjectDocument;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProjectDocumentMapper extends BaseMapper {

    /**
     * 获取成员列表(查的视图)
     * @param fileBo
     * @return
     */
    @Select({
            "<script>",
            "select suf.UPLOADFILENAME as filename,vpd.*,vpd.UPLOAD_TIME as uploadTime from v_project_document vpd ",
            "left join sys_upload_file suf on vpd.FILE_ID = suf.ID ",
            "where 1=1 ",
            "<if test='fileBo.projectClass != null and fileBo.projectClass != \"\"'>",
            "and vpd.PROJECT_CLASS = '${fileBo.projectClass}' ",
            "</if>",
            "<if test='fileBo.fileName != null and fileBo.fileName != \"\"'>",
            "and vpd.FILE_NAME like CONCAT('%', CAST(#{fileBo.fileName} AS CHAR), '%') ",
            "</if>",
            "<if test='fileBo.projectId != null and fileBo.projectId != \"\"'>",
            "and vpd.PROJECT_ID = '${fileBo.projectId}' ",
            "</if>",
            "order by vpd.UPLOAD_TIME asc",
            "</script>"
    })
    List<BizXjProjectDocument> getFileList(@Param("fileBo") VProjectDocumentBo fileBo);
}
